home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / PAS_0493 / COLORS.PAS < prev    next >
Pascal/Delphi Source File  |  1993-04-22  |  884b  |  31 lines

  1. {─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
  2. Msg  : 333 of 474
  3. From : John Guillory                       1:3807/4.4           14 Apr 93  11:59
  4. To   : Rand Nowell
  5. Subj : SHL - SHR
  6. ────────────────────────────────────────────────────────────────────────────────
  7. ->
  8. > Greetings..... Using Shl Shr (I assume) what is the best way to do the
  9. > following?
  10. >
  11. > I have some predefined, or read from config file colors, that are
  12. > stored as attributes, 48 black_on_cyan etc.
  13. > These are in variable names, the above being NORM.
  14. >
  15.  
  16. Try:  }
  17.  
  18. FUNCTION ForeColor(Attrib : BYTE):BYTE;
  19.  
  20. BEGIN
  21.    ForeColor := (Attrib AND $8F);
  22. END;
  23.  
  24. FUNCTION BackColor(Attrib : BYTE):BYTE;
  25.  
  26. BEGIN
  27.   BackColor := (Attrib AND $70) Shr 4;
  28. END;
  29.  
  30. The SHR 4 should work, if not, I Know that DIV 16 will..., The SHR Should be
  31. quicker than Div 16 as well...